<?
set_Cookie(_NAMECOOKIELOGINGUEST,"logouted");

$subject=  isset($_POST['title'])        ?    $_POST['title']     	 : "";
$fullname=  isset($_POST['fullname'])    ?    $_POST['fullname']     : "";
$email=  isset($_POST['email'])          ?    $_POST['email']    	 : "";
$Question=  isset($_POST['Questionmail'])?    $_POST['Questionmail'] : "";

if(!empty($subject) && !empty($fullname) && !empty($email) && !empty($Question))
{
	$rs=$dbsql->query("select * from ".$GLOBALS['first_table']."tbluser where cUserName='$name'");
	if($rq=$dbsql->fetch_array($rs))
	{
		$Question=str_replace("\r\n","<br>",$Question);
		$message="Request from: ".$fullname."<br>";
		$message="Email: ".$email."<br><br><b>Request:</b><br>";
		$message.=$Question;
		if(send_email($rq['cEmail'],$rq['cFullName'],$subject,$message))
		{
			echo "<center>Your email message has been sent<br>Thank you!<br><input type=button value=Close onclick='self.close()'></center>";
			exit();
		}else
		{
			if(send_email($rq['cEmail'],$rq['cFullName'],$subject,$message))
			{
				echo "<center>Your email message has been sent<br>Thank you!<br><input type=button value=Close onclick='self.close()'></center>";
				exit();
			}else
			{
				$alert="Send mail false. Pl. try again!";
			}
		}
	}
}
?>